#温度传感器

import time
from machine import ADC

adc = ADC(0)

def temp(value):
    result = (value/1024.0)*3300
    return result/10

def fahrenheit(celsius):
    return (celsius * (9/5)) + 32

def getTemp():
    while 1:
        reading = adc.read()
        celsius_temp = temp(reading)
        fahrenheit_temp = fahrenheit(celsius_temp)
        print("reading {} Degrees Celsius {} Degrees Fahrenheit {}".format(reading, celsius_temp, fahrenheit_temp))
        time.sleep(3)
